<?php

namespace app\libs\TongtuSDK\Action;

use app\libs\TongtuSDK\TongTuClient;

class AuthToken extends TongTuClient
{
    public function getAppToken()
    {
        return self::get('/open-platform-service/devApp/appToken',['query'=>['accessKey'=>self::APP_KEY,'secretAccessKey'=>self::APP_SECRECT]]);
    }

    public function getAppBuyerList()
    {
      $query = [
          'app_token'=>self::TOKEN,
          'timestamp'=>self::$timestamp,
          'sign'=>self::caculateSign(),
      ];
     // dd($query);
        return self::get(
            '/open-platform-service/partnerOpenInfo/getAppBuyerList',
            [
                'query'=>$query,
            ]
        );
    }

    /**
     * @see https://open.tongtool.com/apiDoc.html#/?docId=1e81e4bbae0b4d60b5f7777fc629ba2a
     */
    public function getAccountList($pageNo = 1,$pageSize = 100)
    {
        return self::post(
            '/openapi/tongtool/merchantSaleAccountQuery',
             [
                 'query'=>[
                     'merchantId'=>self::MERCHANT_ID,
                     'pageNo'=>$pageNo,
                     'pageSize'=>$pageSize
                 ],
             ]
        );
    }
}
